import * as api from '../../api/company-setting';

export default {
  namespaced: true,
  state: {
    roleList: [],
    total: 0,
  },
  mutations: {
    SET_TABLE_DATA (state, newList) {
      state.roleList = newList;
    },
    SET_TOTAL (state, newTotal) {
      state.total = newTotal;
    },
  },
  actions: {
    async updateRoleList (context, params) {
      const res = await api.getRoleData(params);
      context.commit('SET_TABLE_DATA', res.rows);
      context.commit('SET_TOTAL', res.total);
    },
  },
};
